package com.wanqing.community.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.wanqing.community.bean.MenuOperateBean;
import com.wanqing.community.dao.MenuOperateDao;
import com.wanqing.community.dao.util.MyBatisDao;
import com.wanqing.community.util.ConditionParse;
/**
 * 菜单对应功能DAO实现类
 * All right reserved.
 * @version 
 */
@Repository("menuOperateDao")
public class MenuOperateDaoImpl extends MyBatisDao<MenuOperateBean, String> implements MenuOperateDao{
	
	private final String  NAMES_SPACE = "com.wanqing.community.bean.MenuOperateBean";

	/**
	 * <p>Description:添加菜单对应的功能<p>
	 * <p>modifiContent:<p>
	 * @param list
	 * @return
	 */
	public int addMenuOperate(List<MenuOperateBean> lists) {
		if(null!=lists && !lists.isEmpty()){
			return this.saveBatch(NAMES_SPACE+".addMenuOperateBatch", lists);
		}
		return 0;
	}
	
	/**
	 * <p>Description:根据菜单ID删除对应的功能<p>
	 * <p>modifiContent:<p>
	 * @param lists
	 * @return
	 */
	public int deleteMenuOperate(List<String> lists) {			
		return this.deleteBatchById(NAMES_SPACE+".deleteMenuOperate", lists);
	}	
	
	/**
	 * <p>Description:根据条件得到功能列表<p>
	 * <p>modifiContent:<p>
	 * @param condParse
	 * @return
	 */
	public List<MenuOperateBean> queryMenuOperate(ConditionParse condParse) {		
		return this.queryForList(NAMES_SPACE+".queryMenuOperate", condParse);
	}

	/**
	 * <p>Description:根据条件得到菜单数量<p>
	 * <p>modifiContent:<p>
	 * @param condParse
	 * @return
	 */
	public int getMenuOperateCount(ConditionParse condParse) {		
		return this.getCount(NAMES_SPACE+".getMenuOperateCount", condParse);
	}

	/**
	 * <p>Description:修改菜单对应的操作功能<p>
	 * <p>modifiContent:<p>
	 * @param operateBean
	 * @return
	 */
	public int updateMenuOperate(MenuOperateBean operateBean) {		
		return this.update(NAMES_SPACE+".updateMenuOperate", operateBean);
	}

	/**
	 * <p>Description:添加菜单对应的功能<p>
	 * <p>modifiContent:<p>
	 * @param operateBean
	 * @return
	 */
	public int addMenuOperate(MenuOperateBean operateBean) {		
		return this.save(NAMES_SPACE+".addMenuOperate", operateBean);
	}
	
	/**
	 * <p>Description:通过父ID删除子菜单<p>
	 * <p>modifiContent:<p>
	 * @param operateBean
	 * @return
	 */
	public int deleteMenuOperateByMenuId(String menuId) {		
		return this.delete(NAMES_SPACE+".deleteMenuOperateByMenuId", menuId);
	}
	
}
